<template>
  <v-table checked="false" searchFlag="false" details="false" :pageSize="pageSize" :page="page"
    :tableConfig="tableConfig" :tableData="tableData" :total="total" :height="calcHeight(500) + 'px'"
    @findData="getTableData" @getTableData="getTableData" @upData="getTableData" @selectData="setSelectData"
    ref="table"></v-table>
</template>

<script>
import table from 'commons/Table'
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "Table",
  mixins: [baseMixin],
  props: {
    data: {
      type: Object
    }
  },
  data() {
    return {
      tableConfig: [
        {
          label: this.$t('config.shipper'),
          prop: "storerKey",
          input: "input",
        },
        {
          label: this.$t('config.sku'),
          prop: "sku",
          input: "input",
        },
        {
          label: this.$t('in.descr'),
          prop: "descr",
          input: "input",
        },
        {
          label: this.$t('config.loc'),
          prop: "loc",
          input: "input",
        },
        {
          label: this.$t('in.Lot'),
          prop: "lot",
          input: "input",
        },
        {
          label: this.$t('in.palletNo'),
          prop: "palletNo",
          input: "input",
        },
        {
          label: this.$t('in.caseNo'),
          prop: "caseNo",
          input: "input",
        },
        {
          label: this.$t('in.serialNumber'),
          prop: "serialNumber",
          input: "input",
        },
        {
          label: this.$t('config.num'),
          prop: "serialCount",
          input: "input",
        },
      ],
      tableData: [],
      page: 1,
      pageSize: 10,
      total: 10,
      searhData: {}
    }
  },
  methods: {
    //获取table数据
    async getTableData(page, data) {
      data.inventoryId = this.data.argument.inventoryId;
      data.inventoryStatus = "13401";
      data.pageNum = page;
      try {
        let res = await this.$api.post(`/invSernumInventory/selectInvSernumInventoryList`, data);
        
          this.loading = false;
          this.tableData = res.data.data.list;
          //将数据传给复核方法
          this.$parent.$parent.dataList = res.data.data.list;
          this.page = res.data.data.curpage;
          this.pageSize = res.data.data.pageSize;
          this.total = res.data.data.total;
        
      } catch (e) {
        this.$message.error(e);
      }
    },
    //选中的数据
    setSelectData(data) {
      this.$parent.setSelectData(data)
    },
  },
  mounted() {
    this.getTableData(1, {})
  },
  components: {
    'v-table': table
  }
}
</script>

<style scoped>

</style>
